# Maintainer: David Runge <dvzrv@archlinux.org>

_name=aafigure
pkgname=python-aafigure
pkgver=0.6
pkgrel=4
pkgdesc="ASCII art to image converter"
arch=('any')
url="https://github.com/aafigure/aafigure"
license=('BSD')
depends=('python-pillow' 'python-reportlab')
makedepends=('python-setuptools')
checkdepends=('python-pytest')
source=("https://files.pythonhosted.org/packages/source/${_name::1}/${_name}/${_name}-${pkgver}.tar.gz")
sha512sums=('2547fe3ca401e2edd8f8b5b8fc0fa95d0a1392f9d31db2f509dedee4c48d1cf02c04fbb6a3a8e0a7713f675f02f51e460048c0e1f9fd702cebfe379ce30af316')
b2sums=('3d7a431f03ef40cc1fc163cf17044e6b0775b1f9e0da5d9d57d3bc1f589c455b71eac3da7b3ab19553b83f61bfcf305fec87e1297590b17e99a9d33448b7656b')

prepare() {
  mv -v "${_name}-$pkgver" "$pkgname-$pkgver"
}

build() {
  cd "$pkgname-$pkgver"
  python setup.py build
}

check() {
  cd "$pkgname-$pkgver"
  export PYTHONPATH="build:${PYTHONPATH}"
  pytest -v
}

package() {
  cd "$pkgname-$pkgver"
  python setup.py install --skip-build \
                          --optimize=1 \
                          --root="${pkgdir}"
  install -vDm 644 {CHANGES.txt,README.rst} -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -vDm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
